﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ZX.WebApp
{
    public class WorkFlowConst
    {
        //数据访问状态
        public const string STATE_ADD = "新建";
        public const string STATE_MOD = "修改";
        public const string STATE_VIEW = "查看";
        //节点类型
        public const int TaskType_Start = 1;//开始节点
        public const int TaskType_End = 2;//结束节点
        public const int TaskType_Alert = 3;//交互节点
        public const int TaskType_Judge = 4;//控制节点，and 或者or
        public const int TaskType_View = 5;//查看节点
        public const int TaskType_SubWorkFlow = 6;//子流程节点

        //任务实例状态

        public const string TaskStatus_1 = "1";//未处理的任务
        public const string TaskStatus_2 = "2";//执行中的任务
        public const string TaskStatus_3 = "3";//正常执行完毕的任务
        public const string TaskStatus_4 = "4";//退回。
        public const string TaskStatus_5 = "5";//指派。

        //处理者实例状态

        public const string OperStatus_0 = "0";//未处理，也未认领
        public const string OperStatus_1 = "1";//处理完成
        public const string OperStatus_2 = "2";//指派他人
        public const string OperStatus_3 = "3";//已经认领，但还未处理

        //处理者类型
        public const int OperType_1 = 1;//流程启动者
        public const int OperType_2 = 2;//某一任务实际执行者
        public const int OperType_3 = 3;//指定人员
        public const int OperType_4 = 4;//部门
        public const int OperType_5 = 5;//角色
        public const int OperType_6 = 6;//岗位
        public const int OperType_7 = 7;//从变量中获取
        public const int OperType_8 = 8;//某一任务配置的处理者，重用处理者配置
        public const int OperType_9 = 9;//所有人

        //处理者策略
        public const string OperRule_1 = "1";//共享处理任务，此时只产生一个任务实例多个处理者实例
        public const string OperRule_2 = "2";//所以有人都要处理，此时每个处理者产生一个任务实例
        //任务默认命令
        public const string DefaultCommand = "提交";

        // 工作流标志
        public const string WorkFlow_Flow = "WorkFlow";
        public const string WorkFlow_Class = "WorkFlowClass";
        //组织机构类型
        public const string Architecture_Company = "公司";
        public const string Architecture_Department = "部门";
        public const string Architecture_User = "用户";
        public const string Architecture_Duty = "岗位";
        public const string Architecture_DutyLevel = "岗位级别";
        //变量存储类型
        public const string Access_WorkFlow = "1";//流程变量
        public const string Access_WorkTask = "2";//任务变量
        public const string Access_WorkFlowText = "流程变量";//流程变量
        public const string Access_WorkTaskText = "任务变量";//任务变量

        //表单类型
        public const string FormType_Child = "ChildForm";//子表单
        public const string FormType_Main = "MainForm";//主表单
        //弹出界面交互
        public const string TREENODE_TYPE_WIN = "Window";//弹出界面
        public const string TREENODE_TYPE_FUN = "Function";// 执行功能

        //打开窗体的方式
        public const string Windows_TYPE_SDI = "独占";//模态窗体，独占方式打开窗体
        public const string Windows_TYPE_Blank = "新窗口";// 新建窗口中打开窗体
        //系统变量

        public const string SYS_VarFlag = "SYS_";//系统变量名 标识符
        public const string SYSVarType_int = "int";
        public const string SYSVarType_float = "float";
        public const string SYSVarType_double = "double";
        public const string SYSVarType_string = "string";
        public const string SYSVarType_bool = "bool";

        //消息
        public const string SuccessMsg = "任务已成功执行";
        public const string StartWorkflowInstance = "启动流程:{0}。";
        public const string NoFoundOperatorMsg = "创建处理者实例出错,没有找到处理者,请检查是否配置处理者。TaskId={0}";
        public const string NoFoundTaskMsg = "创建next任务实例时,未找到workTaskId={0} commandName={1},的后续任务节点。";
        public const string WorkflowOverMsg = "流程正常结束";
        public const string OperContentErrorMsg = "处理者信息为空，任务无法提交给空处理者!OperContent={0}，workTaskId={1}";
        public const string OperContentExistsMsg = "处理者实例已经存在，引擎自动过滤!OperContent={0}，OperType={1},WorkTaskInstanceId={2}";
        public const string SubWorkflowOverMsg = "子流程正常结束，返回主流程继续执行!";
        public const string ExpressErrorMsg = "判断表达式是否通过错误,condition={0},error={1}";
        public const string ExpressMsg = "取变量值后生成的表达式,condition={0},WorkTaskInstanceId={1}";
        public const string NoPassExpressMsg = "表达式判断没有通过,condition={0},WorkTaskInstanceId={1}";
        public const string PassExpressMsg = "表达式判断通过,condition={0},WorkTaskInstanceId={1}";
        public const string NoFoundVarErrorMsg = "流程模板中未发现变量的配置信息,变量名={0},WorkFlowId={1}";
        public const string NoFoundFlowStartUserMsg = "未发现流程启动者,任务无法提交给启动者,WorkFlowInstanceId={0}";
        public const string NoFoundTaskOperatorMsg = "未发现某一任务的实际处理者,任务无法提交给此人,WorkTaskInstanceId={0}";
        public const string NoFoundVarOperatorMsg = "未能从变量中获取处理者,任务无法提交给此人,变量名={0}";
        public const string NoFoundUserInArchMsg = "在部门或者岗位中未发现成员，ArchitectureId={0}";
        public const string NoFoundUserInGroupMsg = "在部门或者岗位中未发现成员，GroupId={0}";
        public const string NoFoundUserInAllMsg = "在所有人中未发现成员，所有人={0}";
        public const string NoFoundDeptOfUserMsg = "未找到指定人员的所属部门，UserId={0}";
        public const string NoFoundHighDeptOfUserMsg = "未找到指定人员的上级部门，UserId={0}";
        public const string NoFoundHighDeptOfDeptMsg = "未找到指定部门的上级部门，ArchitectureId={0}";
        public const string NoFoundLowerDeptOfUserMsg = "未找到指定人员的下级部门，UserId={0}";
        public const string NoFoundLowerDeptOfDeptMsg = "未找到指定部门的下级部门，ArchitectureId={0}";
        public const string NoFoundLeaderOfDeptMsg = "未找到指定部门的所属主管领导，ArchitectureId={0}";
        public const string NoGetVarValueErrorMsg = "未从流程实例中获取到变量值，变量也未指定默认值，只能返回空字符。变量名={0},WorkTaskInstanceId={1}";
        public const string CreateNextTaskInstanceMsg = "创建next任务实例NowWorkTaskId={0} commandName={1}";
        public const string AssignUserMsg = "指定处理人,创建流程实例和处理人实例.operContent={0}";
        public const string AssignArchitectureMsg = "指定部门或者岗位,创建流程实例和处理者实例.operContent={0}";
        public const string AssignGroupMsg = "指定组,创建流程实例和处理者实例.operContent={0}";
        public const string AssignAllMsg = "指所有人,创建流程实例和处理人实例.operContent={0}";
        public const string NextTaskCountMsg = "需要判断n={0}个任务节点是否符合条件。";
        public const string NextTaskTypeErrorMsg = "下一任务节点类型错误,不支持该类型。TaskType={0},WorkTaskInstanceId={1}";
        public const string IntoSubWorkflowMsg = "进入子流程，子流程名称={0}。";
        public const string ExitSubWorkflowMsg = "退出子流程,重新进入主流程，MainWorkFlowId={0}。";
        public const string CreateAlterTaskMsg = "创建一个交互节点的实例,EndTaskId={0}";
        public const string CreateEndTaskMsg = "创建一个结束节点的实例,EndTaskId={0}";
        public const string CreateViewTaskMsg = "创建一个查看节点的实例,EndTaskId={0}";
        public const string CreateSubWorkflowMsg = "创建一个子流程节点的实例，EndTaskId={0}。";
        public const string CreateJudgeTaskMsg = "创建一个判断节点的实例,EndTaskId={0}。";
        public const string ChenkedJudgeTaskMsg = "检查每个实例是否完成，其中检查结果如下StartTaskId:{0},allPass={1}";
        public const string ResultJudgeTaskMsg = "判断节点是否通过:allPass={0}节点类型:{1}";
        public const string EngineErrorMsg = "引擎执行流程错误:{0}";
        public const string ExcludeUserMsg = "排除该处理人处理任务,UserId={0}";
        public const string WriteLineMsg = "-----------------";
        public const string TaskBackMsg = "退回至提交人!";//此处与存储过程对应WorkTaskSubmitBackPro
        public const int TaskMaxCount = 9999;//最大可接受任务的个数

        //错误代码
        public const string SuccessCode = "000000";//操作成功
        public const string OtherErrorCode = "111111";//其他错误
        public const string ExpressErrorCode = "100000";//表达式判断错误
        public const string InstanceIsCompletedCode = "100001";//流程实例已完成
        public const string TaskAssignErrorCode = "100002";//任务指派错误
        public const string TaskClaimErrorCode = "100003";//任务认领错误
        public const string TaskUnClaimErrorCode = "100004";//放弃任务认领错误
        public const string TaskBackErrorCode = "100005";//任务退回错误
        public const string TaskAccreditErrorCode = "100006";//任务授权错误
        public const string WorkFlowSuspendErrorCode = "100007";//流程挂起错误
        public const string WorkFlowResumeErrorCode = "100008";//流程取消挂起错误 
        public const string WorkFlowAbnormalErrorCode = "100009";//流程异常结束错误 
        public const string NoFoundOperatorCode = "000001";//没有配置处理者
        public const string NoFoundTaskCode = "000002";//没有配置后续任务
        public const string NoFoundInstanceCode = "000003";//没有找到实例
        public const string IsNullUserIdCode = "200000";//用户Id为空
        public const string IsNullWorkFlowIdCode = "200001";//流程Id为空
        public const string IsNullWorkTaskIdCode = "200002";//任务Id为空
        public const string IsNullCommandNameCode = "200003";//命令为空
        public const string IsNullWorkflowInsCaption = "200004";//流程实例名称为空
        public const string IsNullWorkFlowNoCode = "200005";//流程实例编号为空
        public const string IsNullOperatorInsIdCode = "200006";//流程处理者Id为空
        public const string IsNullWorkFlowInsIdCode = "200007";//流程实例Id为空
        public const string IsNullWorkTaskInsIdCode = "200008";//任务实例Id为空
        public const string IsNullUserNameCode = "200009";//用户名为空

        public const string FlowPriority_1 = "1";//流程优先级-普通
        public const string FlowPriority_2 = "2";//流程优先级-紧急
        public const string FlowPriority_3 = "3";//流程优先级-特急

        // 任务节点的权限
        public const string WorkTask_Return = "退回";
        public const string WorkTask_Assign = "指派";
        public const string WorkTask_DyAssignNext = "动态指定";

        //控制节点命令类型
        public const string Command_And = "and";
        public const string Command_Or = "or";

        //消息类型
        public const string MessageType_Receive = "任务到达";
        public const string MessageType_OutTime = "任务超时";


    }
}
